home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 6.3 KB | 254 lines | [TEXT/ToyS] |
- -- User setable
- property kasSwitchEvery : 15 -- Seconds
- property kasAllowedTypes : {"PICT", "JPEG", "JIFF", "fold"}
- property kasTest : false -- In editing evironment
- property kasLoop : true -- Loop indefinitely
- property kasProgress : true -- show progress
-
- -- Internal Globals
- property gasCurrentPaths : {} -- List of current folders
- property gasCurrentPathIdx : 0 -- Index into that
- property gasCurrentPathCnt : 0 -- Number of items of that
-
- property gasCurrentItems : {} -- List of current items
- property gasCurrentItemIdx : 0 -- Index into that
- property gasCurrentItemCnt : 0 -- Number of items of that
-
- property gasDadsList : {-1} -- Push/Pop list of passed gasCurrentItemIdx
- property gasDadsIdx : 1 -- Index into that
- property gasDadsCnt : 1 -- The number of that
-
- property gasFolder : "" -- Current folder we are working in…
- property gasFileName : "" -- Current file name
-
- property kasProgLoc : {0, 0} -- Last progress location
-
- global gasScreenCnt -- Number of monitors
- global gasDoneOne -- Have we done at least one?
- global gasProgW -- Progress window
-
-
- on run
- -- Do all disks?
- if (gasCurrentPaths is {}) then
- set dList to list disks
- repeat with d in dList
- set gasCurrentPaths to gasCurrentPaths & ((d & ":") as alias)
- end repeat
- set gasCurrentPathCnt to the number of items of gasCurrentPaths
- end if
-
- set gasProgW to 0
- set gasDoneOne to false
- set gasScreenCnt to CountScreens()
-
- if (kasTest) then
- repeat while true
- idle
- end repeat
- end if
- end run
-
-
- on open fsObjs
- set gasCurrentPaths to {}
- set gasCurrentPathIdx to 0
-
- set gasCurrentItems to {}
- set gasCurrentItemIdx to 0
-
- -- Split fsObjs into Paths and Items
- repeat with fsItem in fsObjs
- set fsObj to resolve server alias fsItem
-
- if (catalog kind of (basic info for fsObj)) is a folder then
- set gasCurrentPaths to gasCurrentPaths & fsObj
- else if kasAllowedTypes contains (system type of (basic info for fsObj)) then
- set gasCurrentItems to gasCurrentItems & fsObj
- end if
- end repeat
-
- set gasCurrentPathCnt to the number of items of gasCurrentPaths
- set gasCurrentItemCnt to the number of items of gasCurrentItems
-
- set gasDadsList to {-1}
- set gasDadsIdx to 1
- set gasDadsCnt to 1
-
- set gasProgW to 0
- set gasDoneOne to false
- set gasScreenCnt to CountScreens()
-
- if (kasTest) then
- repeat while true
- idle
- end repeat
- end if
- end open
-
-
- on idle
- if (kasProgress and (gasProgW is 0)) then ¬
- set gasProgW to display info titled ¬
- "Desktop Slides" message ¬
- "…" located at kasProgLoc
-
- -- Server gone offline?
- if (gasFolder is not "") then
- try
- set gasFolder to resolve server alias gasFolder
- on error err
- if (kasProgress) then
- display info gasProgW message err at line 2
- display info gasProgW message "OFFLINE!?!" at line 3
- end if
- beep
- return kasSwitchEvery * 10
- end try
- end if
-
- repeat with i from 1 to gasScreenCnt
- set myImage to GetNextImage()
- try
- tell application "Schreibtischhintergrund" to set desktop picture to myImage for screen i
- on error
- beep
- end try
- end repeat
-
- -- Hide Desktop Pictures...
- if (not gasDoneOne) then
- set gasDoneOne to true
- HideApp("dkpx")
- end if
-
- return kasSwitchEvery
- end idle
-
-
- on CountScreens()
- try
- -- Needs Jon's Commands
- return number of items of («event JonsScrL»)
- on error
- end try
-
- return 1
- end CountScreens
-
-
- on HideApp(appID)
- tell application "Finder"
- try
- set pList to (the name of every process whose creator type is appID)
- on error
- return
- end try
-
- if (class of pList is not list) then set pList to {pList}
-
- repeat with p in pList
- try
- set visible of process named p to false
- on error
- beep
- end try
- end repeat
- end tell
- end HideApp
-
-
- on GetNextImage()
- -- Check dropped images…
- if (gasCurrentPathIdx is 0) then
- set gasCurrentItemIdx to gasCurrentItemIdx + 1
- repeat with gasCurrentItemIdx from gasCurrentItemIdx to gasCurrentItemCnt
- set myFile to item gasCurrentItemIdx of gasCurrentItems
- set fInfo to the basic info for myFile
- if (kasAllowedTypes contains (system type of fInfo)) then return myFile
- end repeat
- GetNextPath()
- end if
-
- -- Find next image to process
- repeat while not GetNextFolderImage()
- end repeat
-
- -- Return current image
- -- set myName to (item gasCurrentItemIdx of gasCurrentItems) -- Gives an error?!?
- if (kasProgress) then ¬
- set kasProgLoc to screen location of ¬
- (display info gasProgW message gasFileName at line 1)
-
- return ((gasFolder as string) & gasFileName) as alias
- end GetNextImage
-
-
- on GetNextPath()
- set gasCurrentPathIdx to gasCurrentPathIdx + 1
- if (gasCurrentPathIdx > gasCurrentPathCnt) then
- set gasCurrentPathIdx to 1
- if (not kasLoop) then quit
- end if
- SetCurrentFolder(item gasCurrentPathIdx of gasCurrentPaths)
- end GetNextPath
-
-
- on SetCurrentFolder(newFold)
- set gasFolder to newFold
- set gasCurrentItems to the entries in newFold whose types are in kasAllowedTypes
- set gasCurrentItemIdx to 0
- set gasCurrentItemCnt to the number of items of gasCurrentItems
- end SetCurrentFolder
-
-
- on GetNextFolderImage()
- -- Next item
- set gasCurrentItemIdx to gasCurrentItemIdx + 1
-
- -- Pop a folder?
- if (gasCurrentItemIdx > gasCurrentItemCnt) then
- -- Top of list?
- if (gasDadsIdx is 1) then
- GetNextPath()
- else
- -- Pop one
- SetCurrentFolder(parent spec of (extended info for gasFolder))
- -- Restore index from daddy list
- set gasCurrentItemIdx to item gasDadsIdx of gasDadsList
- set gasDadsIdx to gasDadsIdx - 1
- end if
- return false
- end if
-
- if (kasProgress) then ¬
- set kasProgLoc to screen location of ¬
- (display info gasProgW message (gasFolder as string) at line 3)
-
- repeat with gasCurrentItemIdx from gasCurrentItemIdx to gasCurrentItemCnt
- set myItem to item gasCurrentItemIdx of gasCurrentItems
- set myKind to (the kind of entry in gasFolder named myItem)
-
- if myKind is a folder then
- -- Push current index
- set gasDadsIdx to gasDadsIdx + 1
- if (gasDadsIdx > gasDadsCnt) then
- set gasDadsList to gasDadsList & gasCurrentItemIdx
- set gasDadsCnt to gasDadsCnt + 1
- else
- set item gasDadsIdx of gasDadsList to gasCurrentItemIdx
- end if
- -- Do this folder instead
- SetCurrentFolder(((gasFolder as string) & myItem) as alias)
- return false
- else if (myKind is a file) then -- Don't do aliases for now
- set gasFileName to myItem
- return true
- else
- -- Don't do aliases for now…
- end if
- end repeat
-
- return false
- end GetNextFolderImage
-